﻿<?php
include_once("../initial.php");
include_once("../dbdriver/pageWHandle.php");
include_once("../dbdriver/pageRHandle.php");

include_once("pageLogic.php");


class pageLogic
{
    public function insert_page($array)
    {
        if(is_array($array)==false)
        {
            return false;
        }
        if(count($array)==0)
        {
            return false;
        }
        $whandle = new pageWHandle();
        return $whandle->insert_data($array);
    }
    public function get_page($array='', $orderby='', $limit='')
    {
        $rhandle = new pageRHandle();
        if($array == '')
        {
            return $rhandle->get_all_data($orderby,$limit);
        }
        else
        {
            return $rhandle->get_some_data($array, $orderby, $limit);
        }
    }
    
    public function get_page_num($array='')
    {
        $rhandle = new pageRHandle();
        if(is_array($array)==false)
        {
            $array = array();
        }
        return $rhandle->get_page_num($array);
    }
    public function update_page($array,$id)
    {
        $handle = new pageWHandle();
        return $handle->update_page($array,$id);
    }
    public function delete_page($id)
    {
        $handle = new pageWHandle();
        return $handle->delete_page($id);
    }

    public function get_all_page($orderby="", $limit="")
    {
        $handle = new pageRHandle();
        if($orderby=="")
        {
            $orderby="order by date desc";
        }
        return $handle->get_all_data($orderby,$limit);
    }



}
?>
